<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>新东方高中部预约</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="新东方高中部预约">
    <meta name="keywords" content="新东方高中部预约">
    <meta name="author" content="XIAN Neworiental School Infomatiom Dept.">

    <!-- Le styles -->
    <link href="css/xian.css" rel="stylesheet">
    <link href="css/xian-responsive.css" rel="stylesheet">
    <link href="css/docs.css" rel="stylesheet">
    <link href="js/google-code-prettify/prettify.css" rel="stylesheet">

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="../js/html5shiv.js"></script>
    <![endif]-->


  </head>

  <body data-spy="scroll" data-target=".bs-docs-sidebar">
<?php
    date_default_timezone_set('Etc/GMT-8');  
    //$nowdate = date("Y-m-d H:i:s");
  //$link=mysql_connect('localhost','root','1111'); 
  $username = "xaxdfhr";
  $password = "wearetheworld1985";
try {
   $conn = new PDO('mysql:host=xaxdfdata.mysql.rds.aliyuncs.com;dbname=dbd86kw9q83xzn72', $username, $password);
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $conn->exec("SET NAMES 'utf8'");
   $insert = "insert into gaozhongyuyue (name,phone,place,date) values(\"{$_POST['name']}\",\"{$_POST['phone']}\",\"{$_POST['place']}\",now())";
  $conn->exec($insert); 
  $res = $conn->lastInsertId();
  if($res){
  echo "<script>alert ('您已预约成功！');window.open ('http://xa.xdf.cn/zhuanti/2014autumn/index.html','_self');</script>";
  exit;
  }else{
  //echo $res;
  echo "<script>alert ('您好，出错了。抱歉信息登记失败！请联系029-87916699-7000提供错误信息，谢谢！');window.open ('http://xa.xdf.cn/','_self');</script>";
  exit;
  }
   
    
} catch(PDOException $e) {
   echo 'ERROR: ' . $e->getMessage();
   exit;
}

$conn = null;
?>



  </body>
</html>